package net.xiduth.game.player.dialogues.impl;

import net.xiduth.Settings;
import net.xiduth.game.player.controlers.StartTutorial;
import net.xiduth.game.player.dialogues.Dialogue;
import net.xiduth.utils.npc.DialAnims;

public class XiduthGuide extends Dialogue {

	int npcId;
	StartTutorial controler;

	@Override
	public void start() {
		npcId = (Integer) parameters[0];
		int tutStage = (player.getControlerManager().getControler() instanceof StartTutorial ? (int) player.getControlerManager().getControler().getArguments()[0] : 1);
		if (tutStage == 3) {
			sendNPCDialogue(npcId, DialAnims.TALKING_ALOT.getId(), "Hello, I am the " + Settings.SERVER_NAME + " Tutorial master.", "I will tell you how to make money around " + Settings.SERVER_NAME + ".");
		} else {
			player.getPackets().sendGameMessage("You have no need to talk to him right now...");
			end();
		}
	}

	@Override
	public void run(int interfaceId, int componentId) {
		if (player.getControlerManager().getControler() instanceof StartTutorial
				&& (int) player.getControlerManager().getControler().getArguments()[0] == 3) {
			if (stage == -1) {
				sendPlayerDialogue(DialAnims.HAPPY_TALKING.getId(), "Tell me then! I am a newcomer and I am very interested in " + Settings.SERVER_NAME + ".");
				stage = 0;
			} else if (stage == 0) {
				sendNPCDialogue(npcId, DialAnims.TALKING_ALOT.getId(), "There are several ways to make money. You can slay NPCS to receive coins. The more difficult the NPC is, the more coins you get!");
				stage = 1;
			} else if (stage == 1) {
				sendNPCDialogue(npcId, DialAnims.TALKING_ALOT.getId(), "Skilling for coins is also an option, you can do several skills and upon completion sell your goods to the players.");
				stage = 2;
			} else if (stage == 2) {
				sendPlayerDialogue(DialAnims.TALKING_ALOT.getId(), "Where do I slay monsters?");
				stage = 3;
			} else if (stage == 3) {
				sendNPCDialogue(npcId, DialAnims.TALKING_ALOT.getId(), "You will recieve a crystal after the tutorial. The crystal can be used to bring you", "all around the world of Xiduth.");
				stage = 4;
			} else if (stage == 4) {
				sendPlayerDialogue(DialAnims.TALKING_ALOT.getId(), "Are there any available commands?");
				stage = 5;
			} else if (stage == 5) {
				sendNPCDialogue(npcId, DialAnims.TALKING_ALOT.getId(), "Yes there are a few. You can do ::players, ::switchitemslook", "or ::ticket. And explanation of these commands will be", "in your guide book placed in your inventory", "at the end of the tutorial.");
				stage = 6;
			} else if (stage == 6) {
				sendPlayerDialogue(DialAnims.HAPPY_TALKING.getId(), "So what makes " + Settings.SERVER_NAME + " different from other RSPS?");
				stage = 7;
			} else if (stage == 7) {
				sendNPCDialogue(npcId, DialAnims.TALKING_ALOT.getId(), "Here in Xiduth, we try to bring the most unique content to our players.");
				stage = 8;
			} else if (stage == 8) {
				sendNPCDialogue(npcId, DialAnims.TALKING_ALOT.getId(), "We have 20+ Minigames and instances,", "along with thousands of areas to hunt and train.");
				stage = 9;
			} else if (stage == 9) {
				sendNPCDialogue(npcId, DialAnims.TALKING_ALOT.getId(), "You may now customize your character over at Thessilia.");
				player.getControlerManager().getControler().getArguments()[0] = 4;
				stage = 10;
			} else 
				end();
		} else 
			end();
	}

	@Override
	public void finish() {

	}

}
